import { Ref } from 'vue'

export type ResizingHandle = 'tl' | 'tm' | 'tr' | 'ml' | 'mr' | 'bl' | 'bm' | 'br' | ''
export type ResizingHandleStore = {
  direction: ResizingHandle
  translate: string
}

export interface Position {
  x: number
  y: number
  w: number
  h: number
  angle: number
}

export interface PositionStore {
  [propName: string]: Position
}
export interface MatchedLine {
  row: number[]
  col: number[]
}

export type UpdatePosition = (id: string, position: Position) => void

export type GetPositionStore = (excludeId?: string) => PositionStore

export type SetMatchedLine = (matchedLine: MatchedLine | null) => void

export interface ContainerProvider {
  updatePosition: UpdatePosition
  getPositionStore: GetPositionStore
  setMatchedLine: SetMatchedLine
  disabled: Ref<boolean>
  adsorbParent: Ref<boolean>
  adsorbCols: number[]
  adsorbRows: number[]
}

export type ReferenceLineMap = Record<
  'col' | 'row',
  {
    [propName: number]: Record<'min' | 'max' | 'value', number>
  }
>
